# -*- coding: utf-8 -*-
"""
@Time    : 2022/11/7 10:35
@Author  : JackXia
@Email   : 915624876@qq.com
@QQ      : 915624876
@File    : 数.py
@Software: PyCharm
"""


# 列表之列表

def BinaryTree(r):
    return [r, [], []]

print(1)

def insertLeft(root, newBranch):
    t = root.pop(1)
    if len(t) > 1:
        root.insert(1, [newBranch, t, []])
    else:
        root.insert(1, [newBranch, [], []])
    return root
print(2)


def insertRight(root, newBranch):
    t = root.pop(2)
    if len(t) > 1:
        root.insert(2, [newBranch, [], t])
    else:
        root.insert(2, [newBranch, [], []])
    return root


if __name__ == '__main__':
    bt = BinaryTree('a')
    print(bt)
    insertLeft(bt, 'b')
    print(bt)
    insertLeft(bt, 'b')
    print(bt)
